//根据索引删除元素
Array.prototype.delete = function (...val) {
    val.forEach(el => {
        if (el > -1) {
            this.splice(el, 1)
        }
    })
}

//删除元素
Array.prototype.remove = function (...val) {
    val.forEach(el => {
        var index = this.indexOf(el);
        if (index > -1) {
            this.splice(index, 1);
        }
    })
};

//插入元素
Array.prototype.insert = function (index, ...val) {
    if (index > -1) {
        this.splice(index + 1, 0, ...val)
    }
}

//获取最后一个元素
Array.prototype.last = function () {
    return this[this.length - 1]
}

//递归遍历元素
Array.prototype.recursive = function (node, call) {

    const func = function (el) {
        if (el[node]) el[node].forEach(func)
        call(el)
    }

    this.forEach(func)
}